import * as actionsTypes from './actionType';
import { getSearchSongData } from '@/service/theme-header';

const changeSearchSongListAction = (songList)=>({
  type:actionsTypes.CHANGE_SEARCH_SONG_LIST,
  songList
})

export const changeFocusStateAction = state => ({
  type: actionsTypes.CHANGE_FOCUS_STATE,
  state
})

export const getSearchSongListAction = (searchStr)=>{
  return (dispatch)=>{
    getSearchSongData(searchStr).then((res)=>{
      dispatch(changeSearchSongListAction(res.result.songs))
    })
  }
}